package com.trkj.dao.jpa;

import java.util.List;

import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import com.trkj.pojos.Tbstaff;

public interface LmbTbstaffDAO extends CrudRepository<Tbstaff,Long>{
	@Query("select s.staffNo from  Tbstaff s where s.staffAccount =?1")
    public long findID(String a);
	
	@Query("select s.staffName from  Tbstaff s where s.staffNo =?1")
    public String findName(long a);
	
	/**
	 * 员工的分页查询不包含离职
	 */
	@Query("select s from Tbstaff s where s.staffState != '离职' order by s.staffNo	desc")
	public List<Tbstaff> findTbstaffPageNoOut(Pageable Pageble);
	/**
	 * 员工的姓名与分页之模糊查询
	 * @param pagerble
	 * @param staffName
	 * @return
	 */
	@Query("select s from Tbstaff s  where s.staffState != '离职' and s.staffName like %?1% order by s.staffNo desc")
	public List<Tbstaff> findStaffNameByPage(Pageable pagerble,String staffName);
	
	/**
	 * 员工的编号与分页之模糊查询
	 * @param pagerble
	 * @param staffName
	 * @return
	 */
	@Query("select s from Tbstaff s  where s.staffState != '离职' and s.staffNo like %?1% order by s.staffNo desc")
	public List<Tbstaff> findStaffIdByPage(Pageable pagerble,String id);
}
